    //
//  HighRollerViewController.m
//  SpendFunk
//
//  Created by dongmh on 4/29/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "HighRollerViewController.h"
#import "image.h"

@implementation HighRollerViewController

- (id)init{
	return self;
}
- (void)loadView{
	[super loadView];
	[self initView];
}
- (void)initView{
	
	NSString *path = nil;
	UIImage *img = nil;

	////
	path = [[NSString alloc] initWithFormat:@"%@",IMG_HEADER];
	img = [UIImage imageNamed:path];
	UIImageView *imgvBar = [[UIImageView alloc] initWithFrame:CGRectMake(0, -22, img.size.width, img.size.height)];
	[imgvBar setImage:img];
	[self.view addSubview:imgvBar];
	[imgvBar setUserInteractionEnabled:YES];
	[imgvBar release];
	////
	[path release];
	path = [[NSString alloc] initWithFormat:@"%@",IMG_BKGR_VIEW];
	img = [UIImage imageNamed:path];
	UIImageView *imgvBkgr = [[UIImageView alloc] initWithFrame:CGRectMake(0, 25, img.size.width , img.size.height)];
	[imgvBkgr setImage:img];
	[self.view addSubview:imgvBkgr];
	[imgvBkgr setUserInteractionEnabled:YES];
	[imgvBkgr release];
	
	///
	[path release];
	path = [[NSString alloc] initWithFormat:@"%@",IMG_BTN_LOAD];
	img = [UIImage imageNamed:path];	
	m_pBtnRefresh = [[UIButton alloc] initWithFrame:CGRectMake(320-5-img.size.width, -14, img.size.width, img.size.height)];
	[m_pBtnRefresh setBackgroundImage:img forState:UIControlStateNormal];
	[m_pBtnRefresh setBackgroundColor:[UIColor clearColor]];
	m_pBtnRefresh.titleLabel.textColor = [UIColor whiteColor];
	[m_pBtnRefresh addTarget:nil action:@selector(onClickRefresh) forControlEvents:UIControlEventTouchUpInside];
	[self.view addSubview:m_pBtnRefresh];
	
	// highroller background
	[path release];
	path = [[NSString alloc] initWithFormat:@"%@",IMG_BKGR_HIGHROLLER];
	img = [UIImage imageNamed:path];
	UIImageView *imgvHRBkgr = [[UIImageView alloc] initWithFrame:CGRectMake(0, 20, img.size.width, img.size.height)];
	[imgvHRBkgr setImage:img];
	[self.view addSubview:imgvHRBkgr];
	[imgvHRBkgr setUserInteractionEnabled:YES];
	[imgvHRBkgr release];
	
	// avartar
	[path release];
	path = [[NSString alloc] initWithFormat:@"%@",IMG_AVARTAR_HIGHROLLER];
	img = [UIImage imageNamed:path];
	m_pImgvAvatarHR = [[UIImageView alloc] initWithFrame:CGRectMake(27, 8, img.size.width, img.size.height)];
	[imgvHRBkgr addSubview:m_pImgvAvatarHR];
	[m_pImgvAvatarHR setBackgroundColor:[UIColor redColor]];
	[m_pImgvAvatarHR release];
	
	// text
	m_pTxtfNameHR = [[UITextField alloc] initWithFrame:CGRectMake(100, 20, 80, 20)];
	[imgvHRBkgr addSubview:m_pTxtfNameHR];
	[m_pTxtfNameHR setText:@"test"];
	[m_pTxtfNameHR release];
	
	// table list
	
	m_pTblvListLocation = [[UITableView alloc] initWithFrame:CGRectMake(0, 70, 320, 220)];
	m_pTblvListLocation.delegate = self;
	m_pTblvListLocation.dataSource = self;
	[imgvHRBkgr addSubview:m_pTblvListLocation];
	[m_pTblvListLocation setBackgroundColor:[UIColor clearColor]];
	[m_pTblvListLocation release];
}

#pragma mark UITableViewDelegate


#pragma mark UITableViewDataSource
- (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section{
	return 7;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
	static NSString *CellIdentifier = @"Cell";
	UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
	if (cell == nil) {
		cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
	}
	UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@",IMG_BTN_ARROW]]];
	cell.accessoryView = imageView;
	cell.textLabel.text = @"test";
	
	return cell;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
	return 1;
}
/*
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
        // Custom initialization
    }
    return self;
}
*/

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/

/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
}
*/

/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}


@end
